package com.cloud.rabbitmq.listener;

import com.cloud.rabbitmq.entity.User;
import com.cloud.rabbitmq.utils.JsonUtils;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.core.MessageProperties;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.messaging.handler.annotation.Payload;
import org.springframework.stereotype.Component;

@Component
public class SimpleListener {
    @RabbitListener(queues = {"htDirectQueue"})
    public void  hello(Message message){
        User user = JsonUtils.jsonToBean(new String(message.getBody()), User.class);
        System.out.println(user);
    }
}
